package com.wyw.function.learning.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Comparator;

/**
 * @Title   演示的人的对象
 * @Description     函数式编程的对象
 * @Author Mr Wu yewen.wu.china@gmail.com
 * Update History:
 * Author        Time            Content
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Person {

    private String name;

    private Integer age;

    public static int compareByAge(Person a, Person b) {
        return a.age.compareTo(b.age);
    }

}

class PersonAgeComparator implements Comparator<Person> {

    @Override
    public int compare(Person a, Person b) {
        return a.getAge().compareTo(b.getAge());
    }

}
